<!--{include admin/top.html}-->
	<div class="mainPage">
	{if $act == 'index'}
		<h1 class="title">插件列表 <span class="sub_menu"><a href="{:parse_uri('admin_plugin-add')}">添加</a></span></h1>
		<table align=center width=99% >
			<tr style="">
				<td width="25%">
					<p style="line-height:20px;">
						<b>插件名称</b>
					</p>
				</td>
				<td width="10%">
					<p style="line-height:20px;">
						<b>作者</b>
					</p>
				</td>
				<td width="10%">
					<p style="line-height:20px;">
						<b>所需版本</b>
					</p>
				</td>
				<td width="15%">
					<p style="line-height:20px;">
						<b>日期</b>
					</p>
				</td>
				<td width="30%">
					<p style="line-height:20px;">
						<b>操作</b>
					</p>
				</td>
			</tr>
		{foreach $plugins $k $v}
			<tr style="">
				<td valign=top>
					<p style="line-height:20px;">
						{$v['p_name']} {$v['p_ver']}
					<!--{if @in_array($v['p_code'],$pKeys)}-->
						<b style="color:blue;font-size:12px;font-weight:normal">[已安装]</b>
					<!--{/if}-->
					</p>
				</td>
				<td valign=top>
					<p style="line-height:20px;">
						<A href="{$v['p_link']}" target="_blank">{$v['p_author']}</a>
					</p>
				</td>
				<td align=left >
					<p style="line-height:20px;">
						{$v['ver']}
					</p>
				</td>
				<td align=left >
					<p style="line-height:20px;">
						{:date("Y-m-d H:i",$v['dateline'])}
					</p>
				</td>
				<td>
					<p style="line-height:20px;">
						<!--{if @in_array($v['p_code'],$pKeys)}-->
						<a href="{:parse_uri('admin_plugin-uninstall-pn-%s',$v['p_code'])}">卸载</a>&nbsp;|&nbsp;
						<a href="{:parse_uri('admin_plugin-mgr-pn-%s',$v['p_code'])}">管理</a>&nbsp;|&nbsp;
						<a href="{:parse_uri('admin_plugin-addMenu-pn-%s',$v['p_code'])}">添加管理</a>&nbsp;|&nbsp;
						<a href="{:parse_uri('admin_plugin-addNav-pn-%s',$v['p_code'])}">添加导航</a>
						<!--{else}-->
						<a href="{:parse_uri('admin_plugin-installol-pn-%s',$v['p_code'])}">在线安装</a>
						<!--{/if}-->
					</p>
				</td>
			</tr>
		{/foreach}
		</table>
	{elseif $act=='add'}
		<h1 class="title">添加插件
		<span class="sub_menu"><a href="{:parse_uri('admin_plugin-index')}">返回</a></span>
		</h1>
		<form action="{:parse_uri('admin_plugin-add')}" method="POST"  enctype="multipart/form-data">
		<p style="line-height:25px;">
			选择插件 : <input name="userfile[]" type="file" class="ipt" style="height:20px;width:186px;"/> 
			<span style="color:red;font-size:12px;">请选择ZIP文件</span>
		</p>
		<p style="line-height:30px;text-align:left">
			<input type="submit" name="submit" class="submit" value="提交" />
			<input type="reset" class="submit" value="重置" />
		</p>
		</form>
	{elseif $act == 'installol'}
		<script>
			var post = false;
			var end = false;
			var cnum = 0;
			function start(obj){
				if(post == false){
					$(obj).text("安装中...");
					getProcess();
					$.get("{:parse_uri('admin_plugin-doInstall-key-%s',base64_encode($key))}",function(d){
						if(d == 'fail'){
							alert('安装失败,插件包错误!');
							return false;
						}
					});
					post = true;
				}else{
					if(end){
						alert("您已经安装过了!");
						return false;
					}else{
						alert("安装中,请稍候!");
						return false;
					}
				}
			}

			function getProcess(){
				var timenow = new Date().getTime();
				$.get("{_HTTP_HOST_}/upload/now?"+timenow,function(data){
					cnum = parseInt(data);
					$("#process").css("color","#999");
					$("#process").css("background","#333");
					$("#process").css("width",(data+"%"));
					$("#process").html(data + "%");
					$("#slink").text("已完成 "+ data + "% ,请稍候...");
					
				});
				if( cnum == 100 ){
						$.get("{:parse_uri('admin_tpl-delNow')}");
						end = true;
						$("#slink").text("安装完成!");
						alert("安装完成!");
						location.href = '{:parse_uri("admin_plugin-index")}';
						return false;
				}else{
					setTimeout("getProcess()",500);
				}
			}
		</script>
		<h1 class="title">安装插件
		<span class="sub_menu"><a href="{:parse_uri('admin_plugin-index')}">返回</a></span>
		</h1>
					<ul style="list-style:none">
				<li style="line-height:24px;color:#333;font-size:13px;">
					适用版本: ORA v <span class="errmsg" style="font-size:13px;"> {$plugins[$key]['ver']} </span> 
				</li>
				<li style="line-height:24px;color:#333;font-size:13px;">
					文件大小: <span class="errmsg" style="font-size:13px;"> {:round($fileSize/1024/1024,3)} </span> M 
				</li>
				<li style="padding-top:10px;">
					<div style="width:300px;color:#666;height:20px;background:#fff;border:1px solid #333;">
						<div id="process" style="background:#333;height:18px;color:#fff;border:1px solid #555;text-indent:10px;">准备安装...</div>
					</div>
				</li>
				<li style="padding-top:10px;">
					<a href="javascript:void(0)" Id="slink" onclick="start(this)" style="font-size:13px;color:Red;font-weight:bolder" >点击安装!</a>
				</li>
			</ul>
	{/if}
		<p>&nbsp;</p>
	
	</div>
</body>
</html>